//----------------------------------Include-------------------------------------
#include "mcu.h"
#include "glbvar.h"
//------------------------------------------------------------------------------

//-----------------------------------Macro--------------------------------------
//------------------------------------------------------------------------------

//------------------------------------ISR---------------------------------------
void SysTick_Handler(void)
{
  imcu_digit_input();
  igu64_tick_ms++;
  
#if 0
  static unsigned int cnt;
  if(++cnt >= 1000){
    cnt = 0;
    mcu_led_toggle();
  }
#endif
}
//------------------------------------------------------------------------------

//--------------------------------Public Func-----------------------------------
void mcu_init_systick(void)
{
  uint32_t  clk;
  clk = mcu_get_mclk();
  DL_SYSTICK_init(clk/1000);
  DL_SYSTICK_enableInterrupt();
  DL_SYSTICK_enable();
}

void mcu_delay_ms(uint32_t ms)
{
  uint64_t  t;
  t = igu64_tick_ms;
  while(t + ms > igu64_tick_ms);
}
//------------------------------------EOF---------------------------------------


